//
//  ShareAppDelegate.m
//  HHBroker
//
//  Created by He Wei on 9/24/15.
//  Copyright © 2015 harry. All rights reserved.
//
//#import "ShareAppDelegate.h"
//#import "WXApi.h"
//#import <TencentOpenAPI/QQApiInterface.h>
//#import <MessageUI/MFMessageComposeViewController.h>

//@interface ShareAppDelegate () <MFMessageComposeViewControllerDelegate>
//@end
//
//@implementation ShareAppDelegate
//
//- (void)shareTo:(JYShareType)shareType
//{
//    NSData *data = UIImagePNGRepresentation([UIImage imageNamed:@"button_addBankCard"]);
//    NSURL *urlString = [NSURL URLWithString:@"www.baidu.com"];
//    
//    switch (shareType) {
//        case JYShareTypeWeiChat:
//        case JYShareTypeFriends:
//        {
//            if (![WXApi isWXAppInstalled]) {
//                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"您尚未安装微信" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//                [alert show];
//                return;
//            }
//            SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
//            req.bText = NO;
//            req.text = @"haha";
//            
//            WXMediaMessage *message = [WXMediaMessage message];
//            message.title = @"专访张小龙：产品之上的世界观";
//            message.description = @"微信的平台化发展方向是否真的会让这个原本简洁的产品变得臃肿？在国际化发展方向上，微信面临的问题真的是文化差异壁垒吗？腾讯高级副总裁、微信产品负责人张小龙给出了自己的回复。";
//            [message setThumbImage:[UIImage imageNamed:@"getPhone"]];
//            
//            WXWebpageObject *ext = [WXWebpageObject object];
//            ext.webpageUrl = @"http://tech.qq.com/zt2012/tmtdecode/252.htm";
//            message.mediaObject = ext;
//            
//            req.message = message;
//            if (shareType == JYShareTypeFriends) {
//                req.scene = WXSceneTimeline;
//            } else {
//                req.scene = WXSceneSession;
//            }
//            
//            [WXApi sendReq:req];
//        }
//            break;
//        case JYShareTypeQQ:
//        case JYShareTypeQzone:
//        {
//            if (![QQApiInterface isQQInstalled]) {
//                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"您尚未安装QQ" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//                [alert show];
//                return;
//            }
//            
//            QQApiNewsObject *newsObj = [QQApiNewsObject objectWithURL:urlString title:@"haha" description:@"haha" previewImageData:data];
//            SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
//            QQApiSendResultCode sent;
//            if (shareType == JYShareTypeQQ) {
//                sent = [QQApiInterface sendReq:req];
//            } else {
//                sent = [QQApiInterface SendReqToQZone:req];
//            }
//            DLog(@"req : %d", sent);
//            
//        }
//            break;
//            
//        case JYShareTypeMessage:
//        {
//            if (!self.destinationVC) {
//                return;
//            }
//            if ([MFMessageComposeViewController canSendText]) {
//                MFMessageComposeViewController *message = [[MFMessageComposeViewController alloc] init];
//                message.body = @"haha";
//                message.messageComposeDelegate = self;
//                [self.destinationVC presentViewController:message animated:YES completion:^{
//                }];
//                
//            } else {
//                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"您的设备不可发送短信" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//                [alert show];
//                return;
//            }
//        }
//            break;
//        default:
//            break;
//    }
//    
//}
//
//#pragma mark - delegate
//- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
//{
//    [controller dismissModalViewControllerAnimated:YES];
//}
//
//
//@end
